<template>
	<view class="page">
		<!-- 导航栏 -->
		<view class="navbar">
			<view class="navbar-content">
				<view class="back-button" @click="goBack">
					<uni-icons type="back" size="30" color="#ffff"></uni-icons>
				</view>
				<text class="navbar-title">洗车服务</text>
			</view>
		</view>
		
		<!-- 蓝色背景和搜索栏 -->
		<view class="header">
			<view class="search-container">
				<view class="search-bar">
					<text class="search-placeholder">输入需要搜索的内容</text>
					<view class="search-icon">Q</view>
				</view>
			</view>
			<!-- 历史记录在蓝色背景内 -->
			<view class="history-section">
				<text class="history-text">历史记录: 飞飞汽车美容店 飞飞汽修美容店 飞飞汽修美容店 飞飞汽修美容店 汽车美容店 汽修美容店</text>
			</view>
		</view>
		
		<!-- 内容容器 -->
		<view class="content-container">
			
			<!-- 搜索结果列表 -->
			<view class="results-list">
				<view v-for="(item, index) in shopList" :key="index" class="shop-card" @click="goToDetail(item)">
					<view class="shop-header">
						<text class="shop-name">{{ item.name }}</text>
						<text class="distance">{{ item.distance }}</text>
					</view>
					<view class="shop-info">
						<view class="rating-section">
							<view class="stars">
								<text class="star">★</text>
								<text class="star">★</text>
								<text class="star">★</text>
								<text class="star">★</text>
							</view>
							<text class="rating-score">{{ item.rating }}</text>
							<text class="sales">销量: {{ item.sales }}</text>
						</view>
					</view>
					<view class="shop-content">
						<image class="shop-image" src="/static/车.jpg" mode="aspectFill"></image>
						<view class="shop-details">
							<text class="operating-hours">{{ item.hours }}</text>
							<text class="address">{{ item.address }}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopList: [
					{
						name: '车百事汽车生活馆',
						rating: '4分',
						sales: '556',
						distance: '556m',
						hours: '营业时间: 周一至周五 早上8:00-晚上22:00',
						address: '山阳区人民路与解放路交叉口'
					},
					{
						name: '车百事汽车生活馆',
						rating: '4分',
						sales: '556',
						distance: '556m',
						hours: '营业时间: 周一至周五 早上8:00-晚上22:00',
						address: '山阳区人民路与解放路交叉口'
					},
					{
						name: '车百事汽车生活馆',
						rating: '4分',
						sales: '556',
						distance: '5.6km',
						hours: '营业时间: 周一至周五 早上8:00-晚上22:00',
						address: '山阳区人民路与解放路交叉口'
					},
					{
						name: '车百事汽车生活馆',
						rating: '4分',
						sales: '556',
						distance: '556m',
						hours: '营业时间: 周一至周五 早上8:00-晚上22:00',
						address: '山阳区人民路与解放路交叉口'
					},
					{
						name: '车百事汽车生活馆',
						rating: '4分',
						sales: '556',
						distance: '556m',
						hours: '营业时间: 周一至周五 早上8:00-晚上22:00',
						address: '山阳区人民路与解放路交叉口'
					}
				]
			}
		},
		methods: {
			goBack() {
				uni.navigateBack();
			},
			goToDetail(item) {
				const query = `name=${encodeURIComponent(item.name)}&rating=${encodeURIComponent(item.rating)}&sales=${encodeURIComponent(item.sales)}&distance=${encodeURIComponent(item.distance)}&hours=${encodeURIComponent(item.hours)}&address=${encodeURIComponent(item.address)}`
				uni.navigateTo({
					url: `/index-item/CarWashDetail/index?${query}`
				})
			}
		}
	}
</script>

<style>
	.page {
		background-color: #f5f6fa;
		min-height: 100vh;
		position: relative;
	}
	
	/* 导航栏 */
	.navbar {
		width: 100%;
		height: 88rpx;
		background: linear-gradient(120deg, #1f78ff 0%, #2f89ff 100%);
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.navbar-content {
		width: 100%;
		height: 100%;
		display: flex;
		align-items: center;
		position: relative;
		padding: 0 24rpx;
	}
	
	.back-button {
		position: absolute;
		left: 24rpx;
		width: 60rpx;
		height: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	
	.navbar-title {
		color: #ffffff;
		font-size: 32rpx;
		font-weight: 600;
		text-align: center;
		width: 100%;
	}
	
	/* 头部搜索区域 */
	.header {
		position: absolute;
		top: 68rpx;
		left: 0;
		width: 100%;
		height: 300rpx;
		background: linear-gradient(120deg, #1f78ff 0%, #2f89ff 100%);
		padding: 40rpx 0 20rpx 0;
	}
	
	.search-container {
		width: 86%;
		max-width: 750rpx;
		margin-left: 4%;
		margin-bottom: 24rpx;
	}
	
	.search-bar {
		background: #ffffff;
		border-radius: 40rpx;
		padding: 10rpx 24rpx;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}
	
	.search-placeholder {
		color: #999999;
		font-size: 28rpx;
	}
	
	.search-icon {
		color: #1f78ff;
		font-size: 32rpx;
		font-weight: bold;
	}
	
	/* 内容容器 */
	.content-container {
		position: absolute;
		top: 300rpx;
		left: 50%;
		transform: translateX(-50%);
		width: 94%;
		max-width: 750rpx;
		background: #ffffff;
		border-radius: 20rpx 20rpx 0 0;
		min-height: calc(100vh - 200rpx);
		box-shadow: 0 -4rpx 20rpx rgba(0,0,0,0.1);
	}
	
	/* 历史记录 */
	.history-section {
		padding: 0;
		width:90%;
		margin-left: 5%;
		max-width: 750rpx;
		height: 80rpx;
		overflow: hidden;
	}
	
	.history-text {
		color: #ffffff;
		font-size: 28rpx;
		line-height: 1.5;
		word-wrap: break-word;
		overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
	}
	
	/* 搜索结果列表 */
	.results-list {
		padding: 0 24rpx 24rpx 24rpx;
	}
	
	.shop-card {
		background: #ffffff;
		border-radius: 12rpx;
		padding: 24rpx;
		margin-bottom: 16rpx;
		box-shadow: 0 4rpx 12rpx rgba(0,0,0,0.08);
	}
	
	.shop-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 12rpx;
	}
	
	.shop-name {
		color: #333333;
		font-size: 32rpx;
		font-weight: 600;
	}
	
	.distance {
		color: #1f78ff;
		font-size: 24rpx;
	}
	
	.shop-info {
		margin-bottom: 16rpx;
	}
	
	.rating-section {
		display: flex;
		align-items: center;
		gap: 8rpx;
	}
	
	.stars {
		display: flex;
		gap: 4rpx;
	}
	
	.star {
		color: #ffd700;
		font-size: 24rpx;
	}
	
	.rating-score {
		color: #333333;
		font-size: 24rpx;
		margin-left: 8rpx;
	}
	
	.sales {
		color: #666666;
		font-size: 24rpx;
		margin-left: 16rpx;
	}
	
	.shop-content {
		display: flex;
		gap: 16rpx;
	}
	
	.shop-image {
		width: 120rpx;
		height: 80rpx;
		border-radius: 8rpx;
		flex-shrink: 0;
	}
	
	.shop-details {
		flex: 1;
		display: flex;
		flex-direction: column;
		gap: 8rpx;
	}
	
	.operating-hours {
		color: #666666;
		font-size: 24rpx;
		line-height: 1.4;
	}
	
	.address {
		color: #666666;
		font-size: 24rpx;
		line-height: 1.4;
	}
</style>